package goods

import (
	"time"

	"github.com/maxyang107/jinglan/model"
)

type GoodsChainInfo struct {
	ID              uint      `gorm:"column:id; parimary_key" json:"id"`
	GoodsId         uint      `gorm:"column:goods_id" json:"goods_id"`
	CertificatId    string    `gorm:"column:certificat_id" json:"certificat_id"`
	CertificatHash  string    `gorm:"column:certificat_hash" json:"certificat_hash"`
	CertificatTiime time.Time `gorm:"column:certificat_tiime" json:"certificat_tiime"`
	BlockHeight     uint      `gorm:"column:block_height" json:"block_height"`
	CreateTime      time.Time `gorm:"column:create_time" json:"create_time"`
}

//获取商品链上信息
func GetChainInfo(goodsId_ uint) *GoodsChainInfo {
	var chainInfo GoodsChainInfo

	model.Db.Where(&GoodsChainInfo{GoodsId: goodsId_}).First(&chainInfo)

	return &chainInfo
}
